package com.hroa.web.annotation;

import com.hroa.web.exception.BusinessException;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * Security注解的AOP实现
 * 
 * @author zhangxianjun
 * @version $Id: SecurityAop.java, v 0.1 2015年6月15日 下午7:52:05 zhangxianjun Exp $
 */
@Aspect
@Component
public class SecurityAop {

    private static final Logger log = LoggerFactory.getLogger(SecurityAop.class);

    @Around("@annotation(com.hroa.web.annotation.Security)")
    public Object doCheck(ProceedingJoinPoint joinPoint) throws Throwable {
        try {
            return joinPoint.proceed();
        } catch (Throwable e) {
            throw new BusinessException("", e.getMessage());
        }
    }
}
